<?
$smarty=new Smarty();
if(!ANTIHACK) die("ANTIHACK...");
if($_GET["del"]=="all")
{
	query("DELETE from rsslogs");
	echo "<script>setTimeout('location.href=\"".base_admin."?act=rsslogs\"',500);</script>";
}
include_once("./includes/paging.php");
include_once("../includes/buildlink.php");
$smarty->assign("nameact","Nhật Ký Auto Post");
$table="rsslogs";
$limit=30;
$numpage=20;
$act="rsslogs";
$page=intval($_GET['page']);
$listpage= paging($table,$act,$page,$total,$start,$limit,$numpage);

$q = query("select * from $table order by time desc limit $start,$limit");
while($r=fetch($q))
{
	$q1=query("select * from rssfeed where id=$r[rssid]");
	$r1=fetch($q1);
	$r["rss"]=$r1["url"];
	$q2=query("select * from menu where id=$r1[menuid]");
	$r2=fetch($q2);
	$r["menu"]=$r2["name"];
	if($r["postid"]>0)
		{
			$q1=query("select * from post where id=$r[postid]");
			$r1=fetch($q1);
			$r["link"]=buildlink("post",$r1,"",1);
		}
	else
		$r["link"]="#";
	$r["time"]=date("H:i d/m/Y",$r["time"]);
	$rsslogs[]=$r;
}

$smarty->assign("cur_page",$page);
$smarty->assign("page",$listpage);
$smarty->assign("total",$total);
$smarty->assign("start_count",$start);
$smarty->assign("rsslogs",$rsslogs);
$smarty->display("rsslogs.htm");
?>